#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <limits.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
    fprintf(stdout, "CHAR_BIT is %d\n", CHAR_BIT);
    if (CHAR_MIN < 0)
    {
        fprintf(stdout, "type of char default is signed.\n");
    }

    union endian_test
    {
        unsigned char c;
        uint16_t u;
    } s;
    s.u = 0x0100;
    if (s.c == 0x1)
    {
        fprintf(stdout, "system is big endian.\n");
    }
    else
    {
        fprintf(stdout, "system is little endian.\n");
    }

    fprintf(stdout, "sizeof_char is %zu\n", sizeof (char));
    fprintf(stdout, "sizeof_short is %zu\n", sizeof (short));
    fprintf(stdout, "sizeof_int is %zu\n", sizeof (int));
    fprintf(stdout, "sizeof_long is %zu\n", sizeof (long));
    fprintf(stdout, "sizeof_long_long is %zu\n", sizeof (long long));
    fprintf(stdout, "sizeof_unsigned_char is %zu\n", sizeof (unsigned char));
    fprintf(stdout, "sizeof_unsigned_short is %zu\n", sizeof (unsigned short));
    fprintf(stdout, "sizeof_unsigned_int is %zu\n", sizeof (unsigned int));
    fprintf(stdout, "sizeof_unsigned_long is %zu\n", sizeof (unsigned long));
    fprintf(stdout, "sizeof_unsigned_long_long is %zu\n",
            sizeof (unsigned long long));
    fprintf(stdout, "sizeof_int16_t is %zu\n", sizeof (int16_t));
    fprintf(stdout, "sizeof_int32_t is %zu\n", sizeof (int32_t));
    fprintf(stdout, "sizeof_int64_t is %zu\n", sizeof (int64_t));
    fprintf(stdout, "sizeof_uint16_t is %zu\n", sizeof (uint16_t));
    fprintf(stdout, "sizeof_uint32_t is %zu\n", sizeof (uint32_t));
    fprintf(stdout, "sizeof_uint64_t is %zu\n", sizeof (uint64_t));
    fprintf(stdout, "sizeof_off_t is %zu\n", sizeof (off_t));
    fprintf(stdout, "sizeof_size_t is %zu\n", sizeof (size_t));
    fprintf(stdout, "sizeof_ssize_t is %zu\n", sizeof (ssize_t));
    fprintf(stdout, "sizeof_void_p is %zu\n", sizeof (void *));

    return EXIT_SUCCESS;
}
